package ${packageName};

import java.util.Comparator;

/**
 * ${className} 的比较器类 - 仅支持int类型字段比较
 */
public class ${className}Comparator implements Comparator<${className}> {
    @Override
    public int compare(${className} o1, ${className} o2) {
        // 计算两个对象的所有字段之和
        int sum1 = <#list fields as field>o1.get${field.capitalizedName}()<#if field_has_next> + </#if></#list>;
        int sum2 = <#list fields as field>o2.get${field.capitalizedName}()<#if field_has_next> + </#if></#list>;

        // 返回比较结果（降序排序，即大的在前）
        return Integer.compare(sum2, sum1);
    }
}
